/*
 * InserirRelatorios.java
 *
 * Created on 28 de Fevereiro de 2009, 06:16
 */

package br.com.cpqd.ssar.posprocessamento.gui;

import br.com.cpqd.ssar.utilitarias.ListaTipoRelatorio;
import br.com.cpqd.ssar.utilitarias.RelatorioPosProcessamento;
import br.com.cpqd.ssar.posprocessamento.TipoRelatorio;
import java.awt.Color;
import java.io.IOException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author  carlos
 */
public class JanelaInserirRelatorios extends javax.swing.JDialog {

    private ListaTipoRelatorio listaTipoRelatorio;

    /**
     * Determinar os limites do dominio computacional para validar os valores 
     * informados pelo usuários (x0, x1, y0, y1, z0, z1)
     * 
     * INSERIR ESSAS RESTRICOES A SEGUIR
     */
    private int xmin, xmax, ymin, ymax, zmin, zmax;
    
    RelatorioPosProcessamento   relatorioPosProcessamento;

    /**
     * Parametro que armazena o endereco de onde serao armazenados os relatorios
     */
    String nomeBaseResultados;
            
    /** Creates new form InserirRelatorios */
    public JanelaInserirRelatorios(java.awt.Frame parent, boolean modal, String caminho){
        super(parent, modal);    
        
        this.nomeBaseResultados = caminho;

        relatorioPosProcessamento = new RelatorioPosProcessamento();
        try {
            listaTipoRelatorio = new ListaTipoRelatorio();
        } catch (IOException ex) {
            Logger.getLogger(JanelaInserirRelatorios.class.getName()).log(Level.SEVERE, null, ex);
        }
        //super(parent, modal); 
        initComponents();
        
                // Atribuir aos Labels e Text Box a invisibilidade\
        jLabel4.setVisible(false);
        jLabel5.setVisible(false);
        jLabel6.setVisible(false);
        jLabel7.setVisible(false);
        jLabel8.setVisible(false);
        jLabel9.setVisible(false);
        jLabel10.setVisible(false);
        jLabel11.setVisible(false);
        jLabel12.setVisible(false);
        
        jTextField1.setVisible(false);
        jTextField2.setVisible(false);
        jTextField3.setVisible(false);
        jTextField4.setVisible(false);
        jTextField5.setVisible(false);
        jTextField6.setVisible(false);
        jTextField7.setVisible(false);
        jTextField8.setVisible(false);
        
        jComboBoxOpcao.setVisible(false);
    }

        /**
     * Tenta Aplicar as Propriedades Editadas
     */
    private RelatorioPosProcessamento tentarAplicarPropriedades() {        
        boolean nenhumErro  = true;
        String nome         = null;
        String direction    = null;
        String field        = null;
        Vector vetor        = new Vector();               
        
        TipoRelatorio               tipoRelatorio               = (TipoRelatorio) jComboBoxTipo.getSelectedItem();
        //relatorioPosProcessamento  = new RelatorioPosProcessamento();
               
        if (jComboBoxCampo.getSelectedIndex() > 0)
        {
            field = jComboBoxCampo.getSelectedItem().toString();
            //jComboBoxCampo.setForeground(Color.WHITE);
        }
        else{
            jComboBoxCampo.setForeground(Color.RED);
            nenhumErro = false;
        }
            
        if (jComboBoxDirecao.getSelectedIndex() > 0)
        {
            direction = jComboBoxDirecao.getSelectedItem().toString();
            //jComboBoxDirecao.setForeground(Color.WHITE);
        }
        else{
            jComboBoxDirecao.setForeground(Color.RED);
            nenhumErro = false;
        }    
                
        // Testar P1
        try {
            jTextField1.setForeground(Color.BLACK);
            if (jTextField1.isVisible()==true)
                vetor.add(Double.valueOf(jTextField1.getText()));
        } catch (Exception e) {
            jTextField1.setForeground(Color.RED);
            nenhumErro = false;
        }

        // Testar P2
        try {
            jTextField2.setForeground(Color.BLACK);
            if (jTextField2.isVisible()==true)
                vetor.add(Double.valueOf(jTextField2.getText()));
        } catch (Exception e) {
            jTextField2.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P3
        try {
            jTextField3.setForeground(Color.BLACK);
            if (jTextField3.isVisible()==true)
                vetor.add(Double.valueOf(jTextField3.getText()));
        } catch (Exception e) {
            jTextField3.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P4
        try {
            jTextField4.setForeground(Color.BLACK);
            if (jTextField4.isVisible()==true)
                vetor.add(Double.valueOf(jTextField4.getText()));
        } catch (Exception e) {
            jTextField4.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P5
        try {
            jTextField5.setForeground(Color.BLACK);
            if (jTextField5.isVisible()==true)
                vetor.add(Double.valueOf(jTextField5.getText()));
        } catch (Exception e) {
            jTextField5.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P6
        try {
            jTextField6.setForeground(Color.BLACK);
            if (jTextField6.isVisible()==true)
                vetor.add(Double.valueOf(jTextField6.getText()));
        } catch (Exception e) {
            jTextField6.setForeground(Color.RED);
            nenhumErro = false;
        }
                
        // Testar P7
        try {
            jTextField7.setForeground(Color.BLACK);
            if (jTextField7.isVisible()==true)
                vetor.add(Double.valueOf(jTextField7.getText()));
        } catch (Exception e) {
            jTextField7.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        // Testar P8
        try {
            jTextField8.setForeground(Color.BLACK);
            if (jTextField8.isVisible()==true)
                vetor.add(Double.valueOf(jTextField8.getText()));
        } catch (Exception e) {
            jTextField8.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        if ((tipoRelatorio.getIdtipo()==2)&&(jComboBoxOpcao.getSelectedIndex()<=0)){
            jComboBoxOpcao.setForeground(Color.RED);
            nenhumErro = false;
        }
        
        if (nenhumErro) {     
            if (field.equals("Elétrico"))
                field = "e";
            else
                field = "h";
            relatorioPosProcessamento.setIdTipoRelatorio(tipoRelatorio.getIdtipo());
            relatorioPosProcessamento.setNomeTipoRelatorio(tipoRelatorio.getTypeFDTD());                    
            relatorioPosProcessamento.setCampo(field);
            relatorioPosProcessamento.setDirecao(direction);
            relatorioPosProcessamento.setParametros(vetor);            
            
            if (tipoRelatorio.getIdtipo()==2)
                relatorioPosProcessamento.setDirecaoOpcao(jComboBoxOpcao.getSelectedItem().toString());
            
            relatorioPosProcessamento.setEnderecoBaseRelatorios(this.nomeBaseResultados);

            //System.out.println(":::: NOME::: " + relatorioPosProcessamento.getNomeArquivoRelatorio());
            return relatorioPosProcessamento;
        } else
            return relatorioPosProcessamento=null;
        
    }
    
    /*
     * Retorna o Relatorio inserido ou nulo quando ainda nao atribuido ou 
     * houver algum erro
     */
    public RelatorioPosProcessamento getRelatorioPosProcessamento() {
       return relatorioPosProcessamento; 
    }
    
    public void setRelatorioPosProcessamento(RelatorioPosProcessamento r){
        relatorioPosProcessamento = r;
        Vector parametros         = new Vector();
        parametros                = relatorioPosProcessamento.getParametros();
        
        jComboBoxTipo.setSelectedIndex(relatorioPosProcessamento.getIdTipoRelatorio());

        if (relatorioPosProcessamento.getCampo().contains("e"))
            jComboBoxCampo.setSelectedIndex(1);
        else
            jComboBoxCampo.setSelectedIndex(2);

        if (relatorioPosProcessamento.getDirecao().contains("x"))
            jComboBoxDirecao.setSelectedIndex(1);
        else if (relatorioPosProcessamento.getDirecao().contains("y"))
            jComboBoxDirecao.setSelectedIndex(2);
        else if (relatorioPosProcessamento.getDirecao().contains("z"))
            jComboBoxDirecao.setSelectedIndex(3);
        else
            jComboBoxDirecao.setSelectedIndex(0);
        
        if (relatorioPosProcessamento.getIdTipoRelatorio()==2)
        {
            if (relatorioPosProcessamento.getDirecaoOpcao().contains("x"))
                jComboBoxOpcao.setSelectedIndex(1);
            else if (relatorioPosProcessamento.getDirecaoOpcao().contains("y"))
                jComboBoxOpcao.setSelectedIndex(2);
            else if (relatorioPosProcessamento.getDirecaoOpcao().contains("z"))
                jComboBoxOpcao.setSelectedIndex(3);
            else
                jComboBoxOpcao.setSelectedIndex(0);

        }

            TipoRelatorio tipoRelatorio = (TipoRelatorio) jComboBoxTipo.getSelectedItem();

            if (tipoRelatorio.getNparameters()>0)
            {
                jLabel4.setText(tipoRelatorio.getParameterName(0)+":");
                jLabel4.setVisible(true);
                jTextField1.setVisible(true);
                jTextField1.setText(parametros.get(0).toString());
            }

            if (tipoRelatorio.getNparameters()>1)
            {
                jLabel5.setText(tipoRelatorio.getParameterName(1)+":");
                jLabel5.setVisible(true);
                jTextField2.setVisible(true);
                jTextField2.setText(parametros.get(1).toString());
            }

            if (tipoRelatorio.getNparameters()>2)
            {
                jLabel6.setText(tipoRelatorio.getParameterName(2)+":");
                jLabel6.setVisible(true);
                jTextField3.setVisible(true);
                jTextField3.setText(parametros.get(2).toString());
            }

            if (tipoRelatorio.getNparameters()>3)
            {
                jLabel7.setText(tipoRelatorio.getParameterName(3)+":");
                jLabel7.setVisible(true);
                jTextField4.setVisible(true);
                jTextField4.setText(parametros.get(3).toString());
            }

            if (tipoRelatorio.getNparameters()>4)
            {
                jLabel8.setText(tipoRelatorio.getParameterName(4)+":");
                jLabel8.setVisible(true);
                jTextField5.setVisible(true);
                jTextField5.setText(parametros.get(4).toString());
            }

            if (tipoRelatorio.getNparameters()>5)
            {
                jLabel9.setText(tipoRelatorio.getParameterName(5)+":");
                jLabel9.setVisible(true);
                jTextField6.setVisible(true);
                jTextField6.setText(parametros.get(5).toString());
            }

            if (tipoRelatorio.getNparameters()>6)
            {
                jLabel10.setText(tipoRelatorio.getParameterName(6)+":");
                jLabel10.setVisible(true);
                jTextField7.setVisible(true);
                jTextField7.setText(parametros.get(6).toString());
            }

            if (tipoRelatorio.getNparameters()>7)
            {
                jLabel11.setText(tipoRelatorio.getParameterName(7)+":");
                jLabel11.setVisible(true);
                jTextField8.setVisible(true);
                jTextField8.setText(parametros.get(7).toString());
            }

    }
    
    /**
     * Muda propriedades apresentadas na Janela
     */
    public void mudarPropriedadesJanela(){
        
        Vector parameters;  // Utilizado para recuperar os paramateros da fonte        
        TipoRelatorio tipoRelatorio = (TipoRelatorio) jComboBoxTipo.getSelectedItem();
       
        // Atribuir aos Labels e Text Box a invisibilidade\
        jLabel4.setVisible(false);
        jLabel5.setVisible(false);
        jLabel6.setVisible(false);
        jLabel7.setVisible(false);
        jLabel8.setVisible(false);
        jLabel9.setVisible(false);
        jLabel10.setVisible(false);
        jLabel11.setVisible(false);
        
        jTextField1.setVisible(false);
        jTextField2.setVisible(false);
        jTextField3.setVisible(false);
        jTextField4.setVisible(false);
        jTextField5.setVisible(false);
        jTextField6.setVisible(false);
        jTextField7.setVisible(false);
        jTextField8.setVisible(false);
        
        btnConfirmar.setEnabled(false);

        if ((tipoRelatorio.getIdtipo() >0 )&&(tipoRelatorio!=null))
        {
            // Filme2D
            if (tipoRelatorio.getIdtipo()==2){
                jLabel12.setText("Direção");
                jLabel12.setVisible(true);
                jComboBoxOpcao.setVisible(true);
            }
            else
            {
                jLabel12.setVisible(false);
                jComboBoxOpcao.setVisible(false);
            }
            
                        
            if (tipoRelatorio.getNparameters()>0)
            {
                jLabel4.setText(tipoRelatorio.getParameterName(0)+":");
                jLabel4.setVisible(true);
                jTextField1.setVisible(true);
            }
            if (tipoRelatorio.getNparameters()>1)
            {
                jLabel5.setText(tipoRelatorio.getParameterName(1)+":");
                jLabel5.setVisible(true);
                jTextField2.setVisible(true);
            }

            if (tipoRelatorio.getNparameters()>2)
            {
                jLabel6.setText(tipoRelatorio.getParameterName(2)+":");
                jLabel6.setVisible(true);
                jTextField3.setVisible(true);
            }

            if (tipoRelatorio.getNparameters()>3)
            {
                jLabel7.setText(tipoRelatorio.getParameterName(3)+":");
                jLabel7.setVisible(true);
                jTextField4.setVisible(true);
            }

            if (tipoRelatorio.getNparameters()>4)
            {
                jLabel8.setText(tipoRelatorio.getParameterName(4)+":");
                jLabel8.setVisible(true);
                jTextField5.setVisible(true);
            }

            if (tipoRelatorio.getNparameters()>5)
            {
                jLabel9.setText(tipoRelatorio.getParameterName(5)+":");
                jLabel9.setVisible(true);
                jTextField6.setVisible(true);
            }

            if (tipoRelatorio.getNparameters()>6)
            {
                jLabel10.setText(tipoRelatorio.getParameterName(6)+":");
                jLabel10.setVisible(true);
                jTextField7.setVisible(true);
            }
            
            if (tipoRelatorio.getNparameters()>7)
            {
                jLabel11.setText(tipoRelatorio.getParameterName(7)+":");
                jLabel11.setVisible(true);
                jTextField8.setVisible(true);
            }            
        
            btnConfirmar.setEnabled(true);
        }
    }
    
    @Override
    public String toString(){
        return jComboBoxTipo.getSelectedItem().toString();
    }
    
    
    
   /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jComboBoxTipo = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jComboBoxCampo = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jComboBoxDirecao = new javax.swing.JComboBox();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel4 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTextField7 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jTextField5 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jComboBoxOpcao = new javax.swing.JComboBox();
        btnCancelar = new javax.swing.JButton();
        btnConfirmar = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Inserir Relatório de Pós-Processamento");

        jPanel1.setBackground(new java.awt.Color(231, 240, 250));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Inserir Relatórios (Pós-Processamento)"));

        jComboBoxTipo.setModel(listaTipoRelatorio.getModelo());
        jComboBoxTipo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxTipoActionPerformed(evt);
            }
        });

        jLabel1.setText("Tipos");

        jLabel2.setText("Campo");

        jComboBoxCampo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--- Selecionar ---", "Elétrico", "Magnético" }));
        jComboBoxCampo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxCampoActionPerformed(evt);
            }
        });

        jLabel3.setText("Direção");

        jComboBoxDirecao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--- Selecionar ---", "x", "y", "z" }));
        jComboBoxDirecao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxDirecaoActionPerformed(evt);
            }
        });

        jLabel4.setText("jLabel4");

        jTextField1.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel5.setText("jLabel5");

        jTextField2.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel6.setText("jLabel6");

        jTextField3.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel7.setText("jLabel7");

        jTextField4.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel8.setText("jLabel8");

        jLabel9.setText("jLabel9");

        jTextField6.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel10.setText("jLabel10");

        jTextField7.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel11.setText("jLabel11");

        jTextField8.setMaximumSize(new java.awt.Dimension(6, 20));

        jTextField5.setMaximumSize(new java.awt.Dimension(6, 20));

        jLabel12.setText("jLabel12");

        jComboBoxOpcao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--- Selecionar ---", "x", "y", "z" }));

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/Cancelar.png"))); // NOI18N
        btnCancelar.setText("Cancelar");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        btnConfirmar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/cpqd/ssar/gerenciador/gui/recursos/confirmar.png"))); // NOI18N
        btnConfirmar.setText("Confirmar");
        btnConfirmar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConfirmarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel1))
                            .addComponent(jLabel2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 448, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jComboBoxCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBoxDirecao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jComboBoxOpcao, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)
                    .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)
                    .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)
                    .addComponent(jTextField4, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE))
                .addGap(122, 122, 122)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(btnConfirmar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnCancelar)
                        .addGap(27, 27, 27))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)
                            .addComponent(jTextField6, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)
                            .addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)
                            .addComponent(jTextField8, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE))
                        .addGap(62, 62, 62))))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jTextField1, jTextField2, jTextField3, jTextField4});

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jTextField5, jTextField6, jTextField7, jTextField8});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jComboBoxTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBoxCampo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxDirecao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGap(18, 18, 18)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel12)
                    .addComponent(jComboBoxOpcao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel5)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel6)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel7)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(77, 77, 77)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnCancelar)
                    .addComponent(btnConfirmar))
                .addGap(27, 27, 27))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, jTextField1, jTextField2, jTextField3, jTextField4, jTextField5, jTextField6, jTextField7, jTextField8});

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 360, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jComboBoxCampoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxCampoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxCampoActionPerformed

private void jComboBoxDirecaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxDirecaoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxDirecaoActionPerformed

private void btnConfirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConfirmarActionPerformed
    if (this.tentarAplicarPropriedades()!=null)
        dispose();
    else
        this.mudarPropriedadesJanela();
}//GEN-LAST:event_btnConfirmarActionPerformed

private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
// TODO add your handling code here:            
    dispose();
}//GEN-LAST:event_btnCancelarActionPerformed

private void jComboBoxTipoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTipoActionPerformed
// TODO add your handling code here:
    this.mudarPropriedadesJanela();
}//GEN-LAST:event_jComboBoxTipoActionPerformed

private void jComboBoxOpcaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxOpcaoActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_jComboBoxOpcaoActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnConfirmar;
    private javax.swing.JComboBox jComboBoxCampo;
    private javax.swing.JComboBox jComboBoxDirecao;
    private javax.swing.JComboBox jComboBoxOpcao;
    private javax.swing.JComboBox jComboBoxTipo;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    // End of variables declaration//GEN-END:variables

}
